package com.zw.weiyi.anim;

import android.view.View;
import android.view.animation.AnimationSet;

public abstract class AbstractInOutAnimationSet extends AnimationSet {
	/**
	 * 记录当前动画方向
	 */
	private final Direction mDirectioin;
	
	public enum Direction {//使用枚举类型
		IN, OUT
	}

	public AbstractInOutAnimationSet(Direction directioin, long duration, View[] views) {
		super(true);
		
		mDirectioin = directioin;
		
		switch (directioin) {
		case IN:
			addInAnimation(views);
			break;

		case OUT:
			addOutAnimation(views);
			break;
		}
		
		// 添加完动画之后再设置执行总时间
		setDuration(duration);
	}
	

	public Direction getDirection() {
		return mDirectioin;
	}
	
	/**
	 * @param views
	 */
	protected abstract void addInAnimation(View[] views);
	
	/**
	 * @param views
	 */
	protected abstract void addOutAnimation(View[] views);
	
}